package ws;

public class A {

    public Object test() {
        if (this instanceof B) {
            return self();
        }
        if (this instanceof C) {
            return self();
        }
        return this;
    }

    public Object self() {
        return this;
    }

    public static void main(String[] args) {
        System.out.println(new B().test());
        System.out.println(new C().test());
    }
}
